package com.csu.client.module.messageProcess;


import com.csu.client.module.vo.Cache;
import com.csu.message.BaseMessage;
import com.csu.message.TalkMessage;
import com.daohang361.imqq.ui.BaseFrame;
import com.daohang361.imqq.ui.EIMMainFrame;
import com.daohang361.imqq.ui.EIMTalkFrame;
import com.daohang361.imqq.ui.trayIcon.EIMTrayIcon;

public class TalkMessageProcess implements IMessageProcess{

	public void processMessage(BaseMessage message) {
		final TalkMessage talkMessage=(TalkMessage)message;
		final String friendQQ=message.getSrcQQ();
		
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				Cache cache=Cache.getInstance();
				EIMTalkFrame qqTalkFrame=cache.getTalkFrame(friendQQ);
				EIMTrayIcon trayIcon=EIMTrayIcon.getInStance();
				qqTalkFrame.showMsg(qqTalkFrame.friend.getUserName(), talkMessage.getTalkMsg());
				if(!qqTalkFrame.isVisible()){
					trayIcon.addRevedMessage(talkMessage);
					trayIcon.showIcon(talkMessage.getMsgType());
					trayIcon.setGetMsg(true);
				}
			}
		});
	
	}
}
